package edu.taru.service.impl;

import edu.taru.mapper.RoleMapper;
import edu.taru.mapper.UserRoleMapper;
import edu.taru.pojo.Role;
import edu.taru.pojo.UserRole;
import edu.taru.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class RoleServiceImpl implements RoleService{
    @Autowired
    UserRoleMapper userrole;
    @Autowired
    RoleMapper role;

    @Override
    public int addRole(Role rol) {
        return role.insertRole(rol);
    }

    @Override
    public List<Role> selectRole() {
        return role.selectRole();
    }
    @Override
    public int addUserRole(UserRole role1) {
        return userrole.userInsertRole(role1);
    }
    @Override
    public void deleteUserRole(Integer id) {
        userrole.userDeleteRole(id);
    }
    @Override
    public UserRole userRole(String userId) {
        return userrole.userSelectRole(userId);
    }
    @Override
    public Role userRoleMenu(Integer roleId) {
        return role.selectRoleMenu(roleId);
    }

    @Override
    public List<Role> selectRoleMenu() {
        return role.selectRoleWithMenu();
    }
}
